package com.leo.csdnspider.pipeline;

import com.leo.csdnspider.dao.PopularInfoDao;
import com.leo.csdnspider.entity.PopularInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

/**
 * @ClassName: PopularInfoPipeline
 * @Author: Leo
 * @Description: 热门文章
 * @Date: 9/3/2019 8:24 PM
 */
@Repository
public class PopularInfoPipeline implements Pipeline {

    @Autowired
    PopularInfoDao popularInfoDao;

    @Override
    public void process(ResultItems resultItems, Task task) {
        PopularInfo popularInfo = resultItems.get("popularInfo");
        popularInfoDao.save(popularInfo);
    }
}
